package Gui;

import java.awt.GridLayout;

import javax.swing.JLabel;
import javax.swing.JPanel;
import Main.Defines;

public class StatsPanel extends JPanel {
	// current money
	JLabel m_playerNumber;
	JLabel m_moneyAmount;
	JLabel m_numDealCards;
	JLabel m_numMailCards;
	JLabel m_loanAmount;
	JLabel m_currentDay;
	// number of deal cards
	// number of mail cards
	// loan amount
	private static StatsPanel ref;

	private StatsPanel() {
		setLayout(new GridLayout(1, 0, 0, 0)); // magic number
		m_playerNumber = new JLabel("Player " + (Defines.CP().getID() + 1));
		m_moneyAmount = new JLabel("Cash: $" + Defines.CP().getCash());
		m_numDealCards = new JLabel("Deal Cards: "
				+ Defines.CP().getDealCards().size());
		m_numMailCards = new JLabel("Mail Cards: "
				+ Defines.CP().getMailCards().size());
		m_loanAmount = new JLabel("Loan Debt: $"+Defines.CP().getLoan());
		m_currentDay = new JLabel("Current Day: "+ Defines.CP().getDay());
				
		add(m_playerNumber);
		add(m_currentDay);
		add(m_moneyAmount);
		add(m_numDealCards);
		add(m_numMailCards);
		add(m_loanAmount);

	}

	public static StatsPanel getInstance() {
		if (ref == null) {
			ref = new StatsPanel();
		}
		// //update();
		return ref;
	}

	public void update() {
		
		
		//JLabel m_playerNumber, m_moneyAmount, m_numDealCards, m_numMailCards, m_loanAmount;
		//setLayout(new GridLayout(1, 5, 20, 10));
		m_playerNumber.setText("Player " + (Defines.CP().getID() + 1));
		m_currentDay.setText("Current Day: " + Defines.CP().getDay());
		m_moneyAmount.setText("Cash: $" + Defines.CP().getCash());
		m_numDealCards.setText("Deal Cards: "
				+ Defines.CP().getDealCards().size());
		m_numMailCards.setText("Mail Cards: "
				+ Defines.CP().getMailCards().size());
		m_loanAmount.setText("Loan Debt: $"+Defines.CP().getLoan());
				
	}

}
